package org.umlviewer.model.usecase_diagram;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import org.umlviewer.model.DiagramElement;
import org.umlviewer.model.Constants;
import org.umlviewer.paint.PaintUtils;

/**
 *
 * @author Rafa
 */
public class Boundary extends DiagramElement {
    
    private int WIDTH = 100;
    private int HEIGHT = 100;
    
    public Boundary()
    {
        setName("");
    }
    
    public Boundary(String label)
    {
        setName(label);
    }
    
    @Override
    public void paint(Graphics g2) {
        Graphics2D g = (Graphics2D)g2;    
        setWidth(WIDTH);
        setHeight(HEIGHT);
        g.drawRect(getPosX(), getPosY(), WIDTH, HEIGHT);
        g.setFont(Constants.defaultFont);
        PaintUtils.drawCenterString(g, getName(), getPosX(), getPosY()+10, WIDTH);
        
        if(isSelected())
            super.paintSelected(g);
    }

    public void resize(Rectangle r){
        setPosX(r.x);
        setPosY(r.y);
        WIDTH = r.width;
        HEIGHT = r.height;
    }
    
}
